package com.lc.app.myaccount.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;

import com.lc.app.myaccount.R;
import com.lc.app.myaccount.pic.PictureAdapter;

/**
 * Created by LC on 2/10/2016.
 */
public class Main extends AppCompatActivity {

    GridView gvInfo;
    String[] titles = new String[]{"新增支出","新增收入","我的支出","我的收入","数据管理","系统设置","退出"};
    int[] images = new int[]{R.drawable.addoutaccount,R.drawable.addinaccount,R.drawable.outaccountinfo,R.drawable.inaccountinfo,R.drawable.showinfo,R.drawable.sysset,R.drawable.exit};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        gvInfo = (GridView) findViewById(R.id.gvInfo);
        PictureAdapter adapter = new PictureAdapter(titles,images,this);
        gvInfo.setAdapter(adapter);
        gvInfo.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = null;
                switch (position){
                    case 0:
                        intent = new Intent(Main.this,OutAccountActivity.class);
                        startActivity(intent);
                        break;
                    case 2:
                        intent = new Intent(Main.this,MyOutAccountActivity.class);
                        startActivity(intent);
                    case 6:
                        finish();
                }
            }
        });
    }
}
